package javaCode;

import java.util.Arrays;
import java.util.Scanner;
/**
 * Created by lxy_920912 on 27/04/2017.
 */
public class Baidu1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] price = new int[n];

        for(int i = 0;i < n;i++){
            price[i] = in.nextInt();
        }
        if(n <=3){
            System.out.println(price[n-1]);
            return ;
        }
        Arrays.sort(price);
        int count = 1;
        for(int i = 1;i < n;i++){
            if(price[i] == price[i-1]){
                continue;
            }
            count++;
            if(count == 3){
                System.out.println(price[i]);
                break;
            }
        }


    }
}
